package ord2.core;

/**
 * Specifies a result that will be returned by an indexer. This class contais
 * a resulta name and a result value.
 * @param <K> Type of result that this class contains.
 *
 * @author José Ivan
 * @author Edviges
 * 
 */
public class Result<K> {
    
    private final String name;
    private final K value;
    
    /**
     * Constructs a result with given name and result.
     * @param name Result name.
     * @param value Value returned by result.
     */
    public Result(String name, K value) {
        
        this.name = name;
        this.value = value;
    }
    
    /**
     * Constructs a result with a specified value and a null name.
     * @param value Value returned by result.
     */
    public Result(K value) {
        
        this(null, value);
    }
    
    /**
     * Returns name carried by this result.
     * @return String containing name of this result.
     */
    public final String getName() {
        
        return this.name;
    }
    
    /**
     * Returns value carried by this result.
     * @return K Value of this result.
     */
    public final K getValue() {
        
        return value;
    }
}
